﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link type="text/css" rel="stylesheet" href="Theme/Css/CNframe.css" />
    <script type="text/javascript" src="Scripts/jquery-2.0.3.min.js"></script>
    <script src="Scripts/ShareData.js" type="text/javascript"></script>
    <script type="text/javascript">
        var menuId = share.data("SelectedMenuId");
        var categoryId = share.data("SelectedSubMenuId");
        var current_page = 7;//每页显示的数据
        var current_num = 1;//当前页数  
        var level;
        var total_page;
        var category;
        $(document).ready(function () {
            var next = $(".next");//下一页
            var prev = $(".prev");//上一页     
            var methodName = "";
            if (categoryId == -1) {
                //如果categoryId == 0,则加载当前类别全部列表
                if (menuId == 3) {
                    category = 3;
                }
                if (menuId == 4) {
                    category = 2;
                }
                if (menuId == 5) {
                    category = 4;
                }
                level = 1;
                methodName = "GetArticlePaged";
            }
            else {
                category = categoryId;
                level = 2;
                methodName = "GetArticlePagedBySub";
            }
            //下一页
            $(".next").click(function () {
                if (current_num == total_page) {
                    return false;//如果大于总页数就禁用下一页
                }
                else {
                    ++current_num;
                    getArticles(current_num, current_page, category, level, methodName);
                    $(".current_page").text(current_num);//点击下一页的时候当前页数的值就加1

                }
            });
            //上一页方法
            $(".prev").click(function () {
                if (current_num == 1) {
                    return false;
                } else {
                    --current_num;
                    getArticles(current_num, current_page, category, level, methodName);
                    $(".current_page").text(current_num);

                }
            });
            getArticles(1, current_page, category, level, methodName);
        });

        function getArticles(pageIndex, pageSize, category, level, method) {
            $.ajax({
                //方法所在页面和方法名   
                url: "BlueHomeHandler.ashx?method=" + method + "&pageIndex=" + pageIndex + "&pageSize=" + pageSize + "&category=" + category,
                contentType: "application/json",
                dataType: "json",
                success: function (data) {
                    //返回的数据用data.d获取内容                  
                    //total_q=data.d;
                    $(".total").text(data.PageCount);//显示总页数
                    $(".current_page").text(current_num);//当前的页数
                    total_page = data.PageCount
                    appendArticle(data.ResponseData);
                    return true;
                },
                error: function (err) {
                    alert(err);
                    return false;
                }
            });
        }


        function appendArticle(data) {
            $(".ulul").empty();//每次点击，请div内容清空，但是不删除当前div节点
            for (var i = 0 ; i < data.length; i++) {
                $(".ulul").append("<li><font size='4'><a href='Showpage.html' onclick='toURL(" + data[i].ID + ")' target='rightContent'>" + data[i].Title + "<a/></font></span>" + data[i].CreateDateTime + "</span></li>");//内层循环追加li
            }
        }
        function toURL(cId) {
            share.data("SelectedArticleId", cId);
        }
    </script>
   
</head>
<body>
    <div class="CNright">

        
            <h3><a  style="text-decoration:none;">相关技术文档：</a></h3>
   
        <div class="CNcontent">
            <div class="main-content-body news-list">
                <div class="news-list">
                    <ul class="ulul"></ul>
                    <div class="sp">&nbsp;</div>
                    <div class="sp">&nbsp;</div>
                    <div class="bo">
                        <span class="box" style="margin-left:100px;">
                            <a style="cursor:pointer;" class="prev">上一页</a><span class="num"><span class="current_page">1</span><span style="padding: 0 3px;">/</span><span class="total"></span></span><a style="cursor:pointer;" class="next">下一页</a>
                        </span>
                    </div>
                </div>

            </div>

        </div>
        <div class="clear"></div>
    </div>
</body>
</html>
